c
c	A very simple test program for vopl.
c
c 	This one draws a graph of y = sin(x) 0 <= x <= 2*pi
c
	program test1
#ifdef SGI_GL
#include "fgl.h"
#include "fdevice.h"
#else
#include "fvogl.h"
#include "fvodevice.h"
#endif
	parameter (pi = 3.14159265358979)
	parameter (n = 300)

	integer *2 val
	integer *2 left, right, bottom, top

	real x(n), y(n)

c
c	Generate the points
c
	t = 0.0
	dt = 2 * pi / n

	do 10 i = 1, n
		x(i) = t
		y(i) = sin(t)
		t = t + dt
10	continue

c
c	Adjust the scaling according to x and y arrays
c
	call adjustscale(x, n, 'x')
	call adjustscale(y, n, 'y')
c
c	As we are now about to do some graphics we initialise VOGLE
c	and clear to BLACK
c
	call hfont('times.r', 7)
	call winope('VOPL', 4)
	call qdevic(KEYBD)
	call color(0)
	call clear
c
c	Now set the color to GREEN
c
	call color(2)

c
c	Draw the default set of axes (in GREEN)
c
	call drawaxes2
c
c	Set color to RED
c
	call color(1)
c
c	Draw the Graph
c
	call plot2(x, y, n)
c
c	Wait around a bit
c
	idum = qread(val)
c
c	Now draw a little one in the top right hand corner
c	by reseting the VOGL viewport.
c
        call getvie(left, right, bottom, top)
c
c	Now assign them to integer *4 variables (thanks SGI!)
c
	minx = left
	maxx = right
	miny = bottom
	maxy = top
        call viewpo((minx + maxx) / 2, maxx, (maxy + miny) / 2, maxy)
c
c	Draw it again, but do the plot first (in BLUE) then the axes
c	(in YELLOW)
c
	call color(4)
	call plot2(x, y, n)
	call color(3)
	call drawaxes2
c
c	Hang around again
c
	idum = qread(val)
c
c	Bugger off...
c

	call gexit
	end
